"use strict";
var myApp = angular.module("myApp", ["ui.router", "ngSanitize", "ngAnimate", "oc.lazyLoad"]);
myApp.run(["$rootScope", "$state", "$stateParams",
    function ($rootScope, $state, $stateParams) {
        $rootScope.$state = $state;
        $rootScope.$stateParams = $stateParams;
    }
]);
myApp
    .config(
        ['$controllerProvider', '$compileProvider', '$filterProvider', '$provide',
            function ($controllerProvider, $compileProvider, $filterProvider, $provide) {
                // lazy controller, directive and service
                myApp.controller = $controllerProvider.register;
                myApp.directive = $compileProvider.directive;
                myApp.filter = $filterProvider.register;
                myApp.factory = $provide.factory;
                myApp.service = $provide.service;
                myApp.constant = $provide.constant;
                myApp.value = $provide.value;
            }
        ]);
myApp.controller('myController', ['$scope', '$http', function ($scope, $http) {
    $scope.logout = function () {
        $http.get("logout").then(function (response) {
            if (response.data.result == 'success') {
                window.location.href = ctx + "/login";
            }
        });
    }
}
]);
